-- target_status
-- created by zhuangsl
-- 只对特定目标生效的状态

return {
    apply = function(source, target, skillId, round, para, extra)
        -- 不是指定的怪物
        if target:query("base_class_id") ~= para[5] then
            -- 提示一下
            doAlert(getLocStr("no_reaction_tip"));
            return {};
        end

        local effectRound = -1;
        extra = extra or {};
        local lastRound = extra.lastRound;

        if type(lastRound) == "number" then
            effectRound = round + lastRound + 1;
        elseif para[4] > 0 then
            effectRound = round + para[4] + 1;
        end

        local condition = {
            ["value"] = para[3],
            ["end_round"] = effectRound,
        };

        if para[2] > 0 then
            condition["id"] = para[2];
        end

        -- 增加命中动作
        SkillM.getSequence(target):hit(source, target, skillId);

        -- 附加状态
        CombatStatusM.applyStatus(target, para[1], condition);

        -- 返回作用目标
        return { target, };
    end,

    parse = function(desc)
        local arr = string.explode(desc, ",");
        return { arr[1], tonumber(arr[2]), tonumber(arr[3]), tonumber(arr[4]), tonumber(arr[5])};
    end,

    -- 解析技能描述
    parseDesc = function(source, skillId, desc, para)
        local value = para[3];
        desc = string.gsub(desc, "{num_value}", value);
        value = math.modf(value / 10);
        desc = string.gsub(desc, "{ratio_value}", value);

        local round = para[4];
        desc = string.gsub(desc, "{round}", round);

        return desc;
    end,
};
